package com.zhuchaofan.zsbback.controller;


import com.zhuchaofan.zsbback.service.BookService;
import com.zhuchaofan.zsbback.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;




@CrossOrigin(origins="http://localhost:5500")
@RestController
public class BookController {
    @Autowired
    private BookService bookService;

    @GetMapping("/books")
    public R getBooks(int page,int limit,@RequestParam(required = false,defaultValue = "") String name) {
        return R.ok(bookService.findAllBooks(page,limit,name));
    }

}


